<?php

namespace App\Http\Controllers\Admin;

use App\Helpers\ApiResponse;
use App\Helpers\UploadHelper;
use App\Http\Controllers\Controller;
use App\Services\SysFileService;
use Illuminate\Http\Request;

/**
 * 系统文件控制器
 * @package App\Http\Controllers\Admin
 */
class SysFileController extends Controller
{
    use ApiResponse;
    use UploadHelper;
    private $sysFileSer;

    /**
     * 构造函数
     */
    public function __construct()
    {
        $this->sysFileSer = new SysFileService();
    }

    /**
     * 文件列表
     * @param Request $request
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function index(Request $request)
    {
        if ($request->ajax()) {
            $pageSize = $request->get('pageSize', 10);
            $query = \App\Models\WxQrcodeScanlog::select('*');
            //扫码用户openid
            $from_openid = $request->get('from_openid', '');
            if ($from_openid) {
                $query->where('from_openid', $from_openid);
            }
            return $query->paginate($pageSize);
        }
        return view('admin.sysfile.index', $this->viewData);
    }
}
